#include "DataStructure/Input/Constraint/RSPLINEData.h"

#include "DataStructure/Common/Validation.h"
#include "DataStructure/Input/Solver/DOFDirections.h"

using namespace SG::DataStructure;

/// @brief 返回参与约束方程的自由度方向的实例。
SG::DataStructure::FEM::DofSet FEM::RSPLINEData::NodeComponent::GetDofs () const
{
    return Int2VDofSet (m_dofs);
}

/// @brief 判断两个NodeComponent是否相等
bool SG::DataStructure::FEM::operator== (const RSPLINEData::NodeComponent& a, const RSPLINEData::NodeComponent& b)
{
    if (a.m_nodeId != b.m_nodeId)
    {
        return false;
    }
    if (a.m_dofs != b.m_dofs)
    {
        return false;
    }
    return true;
}

/// @brief 判断两个RSPLINEData是否相等
bool SG::DataStructure::FEM::operator== (const RSPLINEData& a, const RSPLINEData& b)
{
    if (a.m_id != b.m_id)
    {
        return false;
    }
    if (a.m_g1 != b.m_g1)
    {
        return false;
    }
    if (a.m_domainId != b.m_domainId)
    {
        return false;
    }
    if (a.m_items != b.m_items)
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_slender, b.m_slender))
    {
        return false;
    }
    return true;
}
